#include <stdio.h>

int my_strlen(char *arrs) {
    int n;
    for (n = 0; arrs[n] != '\0'; n++) { ;
    }
    return n;
}

//简单明了
void reverse_string(char *arrs) {
    int left = 0;
    int right = my_strlen(arrs) - 1;
    for (char tmp; left < right; left++, right--) {
        tmp = arrs[right];
        arrs[right] = arrs[left];
        arrs[left] = tmp;
    }
}

void reverse_strings(char *arrs) {
    int left = 0;
    int right = my_strlen(arrs) - 1;
    char tmp;
    tmp = *(arrs + left);
    *(arrs + left) = *(arrs + right);
    *(arrs + right) = tmp;
}

//递归思想:仅拓宽思维，此处不太合适
void reverse_string_max(char *arrs) {

    int right = my_strlen(arrs) - 1;
    char tmp = *arrs;
    *arrs = *(arrs + right);
    *(arrs + right) = '\0';
    if (my_strlen(arrs) > 2) {
        printf("%d", my_strlen(arrs));
        reverse_string_max(arrs + 1);
    }
    *(arrs + right) = tmp;
}

int main() {
    char arr[] = "abcdef";
    reverse_string(arr);
    printf("%s", arr);
    return 0;
}